import { connect, mapProps } from '@formily/vue'
import ColumnsTable from '@/components/ColumnsTable'

export default connect(
  ColumnsTable,
  mapProps(
    (props) => {
      if (props.multiple) {
        return {
          ...props,
          'checkedRowKeys': props.value,
          'onUpdate:checkedRowKeys': props.onChange,
        }
      }
      else {
        return {
          ...props,
          'multiple': false,
          'checkedRowKey': props.value,
          'onUpdate:checkedRowKey': props.onChange,
        }
      }
    },
  ),
)
